package com.eight.travel.service.impl;

import com.eight.travel.dao.OrderMapper;
import com.eight.travel.pojo.HotelOrder;
import com.eight.travel.service.OrderService;
import com.eight.travel.utils.BaseResp;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    OrderMapper orderMapper;

    @Override
    public BaseResp selectHByUid(Integer uid) {
        List<HotelOrder> hotelOrders = orderMapper.selectHByUid(uid);
        if(hotelOrders != null){
            return new BaseResp().SUCCESS("用户全部酒店订单", hotelOrders, null);
        }
        return new BaseResp().FAIL("查询失败");
    }

    @Override
    public BaseResp updateHotelOrder(Integer hroominfoid) {
        int i = orderMapper.updateHotelOrder(hroominfoid);
        if(i == 1){
            return new BaseResp().SUCCESS2("成功退订酒店");
        }
        return new BaseResp().FAIL("退订酒店失败");
    }
}
